<ResourceDictionary
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
   xmlns:System="clr-namespace:System;assembly=mscorlib"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   mc:Ignorable="d">


    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" x:Key="pathOneFill">
        <GradientStop Offset="0" Color="#FF0055AB"/>
        <GradientStop Offset="1" Color="#FF79B0E7"/>
    </LinearGradientBrush>


    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" x:Key="pathTwoFill">
        <GradientStop Offset="0" Color="#FF0055AB"/>
        <GradientStop Offset="1" Color="#FF79B0E7"/>
    </LinearGradientBrush>


    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" x:Key="ExpanderUpHeaderStylePathFill">
        <GradientStop Offset="0" Color="#FF0055AB"/>
        <GradientStop Offset="1" Color="#FF79B0E7"/>
    </LinearGradientBrush>


    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" x:Key="ExpanderUpHeaderStylePathTwoFill">
        <GradientStop Offset="0" Color="#FF0055AB"/>
        <GradientStop Offset="1" Color="#FF79B0E7"/>
    </LinearGradientBrush>


    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" x:Key="Path1Fill">
        <GradientStop Offset="0" Color="#FF0055AB"/>
        <GradientStop Offset="1" Color="#FF79B0E7"/>
    </LinearGradientBrush>


    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" x:Key="Path2Fill">
        <GradientStop Offset="0" Color="#FF0055AB"/>
        <GradientStop Offset="1" Color="#FF79B0E7"/>
    </LinearGradientBrush>

    <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border FocusVisualStyle="{x:Null}" Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" FocusVisualStyle="{x:Null}" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="25"/>
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Column="2">
                                <ContentControl x:Name="HeaderIcon">
                                    <Grid >
                                        <Grid.LayoutTransform>
                                            <TransformGroup>
                                                <TransformGroup.Children>
                                                    <TransformCollection>
                                                        <RotateTransform Angle="90"/>
                                                    </TransformCollection>
                                                </TransformGroup.Children>
                                            </TransformGroup>
                                        </Grid.LayoutTransform>
                                        <Image x:Name="isok" Source="ThemesImage/Button/dropdown.png"
                                       Width="10" Height="7" />
                                    </Grid>
                                </ContentControl>
                            </Grid>

                            <DockPanel Grid.Column="0" FocusVisualStyle="{x:Null}">
                                <ContentPresenter
                   Width="Auto"
                   HorizontalAlignment="Stretch"
                   Margin="2,0,4,0"
                   VerticalAlignment="Center"
                   RecognizesAccessKey="True"
                   SnapsToDevicePixels="True"/>
                            </DockPanel>
                            <Border  Grid.Column="2" BorderThickness="0,0,0,1" BorderBrush="#FFF4F4F5">

                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="25"/>
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Column="2" x:Name="HeaderIcon">
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="180"/>
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Image x:Name="isok" Source="ThemesImage/Button/dropdown.png"
                                       Width="10" Height="7" />
                            </Grid>
                            <ContentPresenter
                 Grid.Column="0"
                 HorizontalAlignment="Left"
                 Margin="4,0,0,0"
                 VerticalAlignment="Center"
                 RecognizesAccessKey="True"
                 SnapsToDevicePixels="True"/>
                            <Border  Grid.Column="2" BorderThickness="0,0,0,1" BorderBrush="#FFF4F4F5">

                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="25"/>
                                <RowDefinition Height="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.RowDefinitions>
                            <Grid>
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="-90"/>
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Image x:Name="isok" Source="ThemesImage/Button/dropdown.png"
                                       Width="10" Height="7" />
                            </Grid>
                            <ContentPresenter
                 Grid.Row="2"
                 HorizontalAlignment="Center"
                 Margin="0,4,0,0"
                 VerticalAlignment="Top"
                 RecognizesAccessKey="True"
                 SnapsToDevicePixels="True"/>
                        </Grid>
                    </Border>
                    <!--<ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="true">
              <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="true">
              <Setter TargetName="circle" Property="Stroke" Value="#666"/>
              <Setter TargetName="arrow" Property="Stroke" Value="#222"/>
              <Setter TargetName="shadow" Property="Visibility" Value="Visible"/>
            </Trigger>
          </ControlTemplate.Triggers>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--<Style x:Key="ExpanderHeaderFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>-->
    <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border FocusVisualStyle="{x:Null}" Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" FocusVisualStyle="{x:Null}" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Column="1" Margin="12,0,0,0">
                                <ContentControl >
                                    <Grid  x:Name="HeaderIcon">
                                        <Image x:Name="isok" Source="ThemesImage/Button/expander_down.png"
                                       Width="10" Height="12" VerticalAlignment="Center" />
                                    </Grid>
                                </ContentControl>
                            </Grid>

                            <DockPanel Grid.Column="0" FocusVisualStyle="{x:Null}">
                                <ContentPresenter
                   Width="Auto"
                    TextElement.Foreground="#303133"
                    TextElement.FontFamily="Microsoft YaHei,Microsoft JhengHei"
                    TextElement.FontSize="14"
                   TextElement.FontWeight="Medium"
                   HorizontalAlignment="Stretch"
                   Margin="0,0,4,0"
                   VerticalAlignment="Center"
                   RecognizesAccessKey="True"
                   SnapsToDevicePixels="True"/>
                            </DockPanel>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Source" TargetName="isok" Value="ThemesImage/Button/expander_up.png" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="False">
                            <Setter Property="UIElement.RenderTransform" TargetName="HeaderIcon" >
                                <Setter.Value>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform  Angle="0"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>

                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>

        </Setter>
    </Style>
    <Style TargetType="{x:Type Expander}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <Border Margin="0,2,0,0"
             Background="{TemplateBinding Background}"
             BorderBrush="#B0B0B0"
             BorderThickness="0,1,0,0"
             CornerRadius="0"
             SnapsToDevicePixels="true">
                        <DockPanel Margin="0,10,0,0">
                            <ToggleButton
                 x:Name="HeaderSite"
                 MinHeight="0"
                 MinWidth="0"
                 Margin="0"
                 Content="{TemplateBinding Header}"
                 ContentTemplate="{TemplateBinding HeaderTemplate}"
                 ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                 DockPanel.Dock="Top"
                 FocusVisualStyle="{x:Null}"
                 FontFamily="{TemplateBinding FontFamily}"
                 FontSize="{TemplateBinding FontSize}"
                 FontStretch="{TemplateBinding FontStretch}"
                 FontStyle="{TemplateBinding FontStyle}"
                 FontWeight="{TemplateBinding FontWeight}"
                 Foreground="White"
                 HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                 IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                 Padding="{TemplateBinding Padding}"
                 Style="{StaticResource ExpanderDownHeaderStyle}"
                 VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <ContentPresenter
                 x:Name="ExpandSite"
                 Content="{TemplateBinding Content}"
                 HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                 Margin="0,5,0,0"
                 VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                 DockPanel.Dock="Bottom"
                 FocusVisualStyle="{x:Null}"
                 Visibility="Collapsed"/>
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right"/>
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left"/>
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderRightHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Top"/>
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Bottom"/>
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderUpHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Left"/>
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right"/>
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>